package com.ayoka.widget;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ProgressBar;

import com.ayoka.R;
import com.jcp.baselibrary.dialog.BaseDialogBuilder;
import com.jcp.baselibrary.dialog.BaseDialogFragment;

/**
 * Created by jinchunping on 2019/1/23.
 */

public class ShareDialog extends BaseDialogFragment {

    public static ShareDialog newInstance(BaseDialogBuilder builder) {
        ShareDialog dialog = new ShareDialog();
        Bundle bundle = getArgumentBundle(builder);
        dialog.setArguments(bundle);
        return dialog;
    }

    @Override
    protected void convertView(@Nullable View container, final BaseDialogFragment dialogFragment) {
        container.findViewById(R.id.tv_share_wechat).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (shareSelectedListener != null){
                    shareSelectedListener.onShareSelected();
                }
            }
        });
    }

    @Override
    protected int getLayoutId() {
        return R.layout.dialog_share;
    }


    public static class Builder extends BaseDialogBuilder<Builder, ShareDialog> {

        @Override
        public ShareDialog build() {
            return ShareDialog.newInstance(this);
        }
    }

    private OnShareSelectedListener shareSelectedListener;

    public void setShareSelectedListener(OnShareSelectedListener shareSelectedListener) {
        this.shareSelectedListener = shareSelectedListener;
    }

    public interface OnShareSelectedListener{
        void onShareSelected();
    }
}